<?php

/**
 * This is the model class for table "tbtt_ads1".
 *
 * The followings are the available columns in table 'tbtt_ads1':
 * @property integer $ads_id
 * @property string $ads_title
 * @property string $ads_desc
 * @property string $ads_url
 * @property string $ads_begindate
 * @property integer $ads_duration
 * @property string $ads_website
 * @property string $ads_customer_name
 * @property string $ads_phone
 * @property integer $ads_order
 * @property string $ads_image
 */
class Ads extends CActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @param string $className active record class name.
	 * @return Ads the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'tbtt_ads1';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('ads_duration, ads_order', 'numerical', 'integerOnly'=>true),
			array('ads_title', 'length', 'max'=>50),
			array('ads_url', 'length', 'max'=>360),
			array('ads_website, ads_image', 'length', 'max'=>120),
			array('ads_customer_name, ads_phone', 'length', 'max'=>40),
			array('ads_desc, ads_begindate', 'safe'),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('ads_id, ads_title, ads_desc, ads_url, ads_begindate, ads_duration, ads_website, ads_customer_name, ads_phone, ads_order, ads_image', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'ads_id' => 'Ads',
			'ads_title' => 'Ads Title',
			'ads_desc' => 'Ads Desc',
			'ads_url' => 'Ads Url',
			'ads_begindate' => 'Ads Begindate',
			'ads_duration' => 'Ads Duration',
			'ads_website' => 'Ads Website',
			'ads_customer_name' => 'Ads Customer Name',
			'ads_phone' => 'Ads Phone',
			'ads_order' => 'Ads Order',
			'ads_image' => 'Ads Image',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('ads_id',$this->ads_id);
		$criteria->compare('ads_title',$this->ads_title,true);
		$criteria->compare('ads_desc',$this->ads_desc,true);
		$criteria->compare('ads_url',$this->ads_url,true);
		$criteria->compare('ads_begindate',$this->ads_begindate,true);
		$criteria->compare('ads_duration',$this->ads_duration);
		$criteria->compare('ads_website',$this->ads_website,true);
		$criteria->compare('ads_customer_name',$this->ads_customer_name,true);
		$criteria->compare('ads_phone',$this->ads_phone,true);
		$criteria->compare('ads_order',$this->ads_order);
		$criteria->compare('ads_image',$this->ads_image,true);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}
}